import time

from selenium.webdriver.support.select import Select

from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
testCase="DBshop030_编辑普通商品标签"
firefox=openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu3(firefox,"商品管理","商品标签","普通商品标签")

firefox.find_element_by_link_text("编辑").click()
s=Select(firefox.find_element_by_xpath("//select"))
s.select_by_visible_text("小米老二")
firefox.find_element_by_id("tag_name").clear()
firefox.find_element_by_id("tag_name").send_keys("小米机器人")
firefox.find_element_by_id("tag_sort").clear()
firefox.find_element_by_id("tag_sort").send_keys("2")
firefox.find_element_by_xpath("//button").click()

num=firefox.find_element_by_xpath("//td[text()='小米老二']/parent::tr/td[2]/input").get_property("value")
print(num)

try:
    num=="2"
    writeLog("%s 测试通过"%testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)
